package com.action;

import com.model.Student;
import com.service.StudentService;
import com.service.StudentServiceImpl;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.service.RandomStudent;

import java.util.ArrayList;
import java.util.List;


/*
* 不使用事务管理
* */

@Component
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:springmybatis.xml"})
public class Action {

    static Execute sma = new Execute();
    static Student student = new RandomStudent().getStudent();
    static final Logger logger = Logger.getLogger(Action.class.getName());

    @Autowired
    StudentService studentService;

    @Test
    public void curdTest(){

        Student student = new RandomStudent().getStudent();
        studentService.insertOne(student);

        logger.info(student);
//
//        Execute sma = new Execute();
//        List<Student> students = new ArrayList<>();
//        RandomStudent randomStudent = new RandomStudent();
//
//        for(int i=0;i<10;i++){
//            student = randomStudent.getStudent();
//
//            students.add(student);
//        }
//
//        sma.insertForList(students);
//        sma.selectOne(33);
//        sma.updateOne(student);

    }


}
